package main

import (
	"github.com/gin-gonic/gin"
	"time"
	"wish/middleware"
)

func init() {

}
func main() {
	r := gin.Default()
	r.Use(middleware.CustomIPMiddleware())
	r.GET("/ping", func(c *gin.Context) {
		ip, _ := c.Get("remote_ip")
		s, ok := ip.(string)

		c.JSON(200, gin.H{
			"message": "pong " + time.Now().Format("2006-01-02 15:04:05"),
			"ip":      ip,
			"ok":      ok,
			"str":     s,
		})
	})
	r.Run(":8080")
}
